<template>
  <div>
    <!-- 封面 -->
    <div class="bg-wrap my-animation-slide-top">
      <!-- 背景图片 -->
      <el-image
        class="love-image my-el-image"
        lazy
        :src="backgroundPath ? backgroundPath : $constant.bgImg"
        fit="cover"
      >
        <div slot="error" class="image-slot"></div>
      </el-image>

      <!-- 对象 -->
      <div class="love-wrap transformCenter">
        <div>
          <el-avatar class="love-avatar" :src="love.manCover"></el-avatar>
          <div class="love-title">
            {{ love.manName }}
          </div>
        </div>
        <div>
          <img class="love-img" src="@/assets/file/like.svg" alt="心心"/>
        </div>
        <div>
          <el-avatar class="love-avatar" :src="love.womanCover"></el-avatar>
          <div class="love-title">
            {{ love.womanName }}
          </div>
        </div>
      </div>

      <div id="bannerWave1"></div>
      <div id="bannerWave2"></div>
    </div>

    <!-- 内容 -->
    <div class="love-container">
      <div class="myCenter love-content">
        <!-- 时间 -->
        <div>
          <!-- 计时 -->
          <div>
            <div class="love-time-title1">这是我们一起走过的</div>
            <div class="love-time1">
              第
              <span class="love-time1-item">{{ love.time.year }}</span>
              年
              <span class="love-time1-item">{{ love.time.month }}</span>
              月
              <span class="love-time1-item">{{ love.time.day }}</span>
              日
            </div>
          </div>
          <!-- 倒计时 -->
          <div
            class="love-time-title2"
            v-if="
              !$common.isEmpty(love.countdownTitle) ||
              !$common.isEmpty(love.countdownTime)
            "
          >
            {{ love.countdownTitle }}: {{ countdownChange }}
          </div>
        </div>
      </div>

      <div style="padding: 0 20px">
        <div class="family-button shadow-box-mini">
          <span class="family-button-title">一起走过的瞬间</span>
          <span class="family-button-car">
            <svg class="icon" aria-hidden="true" style="width: 50px; height: 50px; padding-bottom: 10px">
              <use xlink:href="#icon-tubiaozhizuomoban"/>
            </svg>
          </span>
        </div>
      </div>

      <div style="padding: 0 20px">
        <time-line
          :time-line-list="timeLineList"
          :avatar="$store.state.webInfo.avatar"
          @launch="launch"
        >
        </time-line>
      </div>
      <div>
        <!-- 页脚 -->
        <myFooter></myFooter>
      </div>
    </div>
  </div>
</template>

<script>
import mixins from "@/utils/mixins";
const timeLine = () => import("./timeLine.vue");

export default {
  mixins: [mixins],
  components: {
    timeLine
  },

  data() {
    return {
      timeLineList: [],
      pagination: {
        current: 1,
        size: 10,
        total: 0,
      },
      love: {
        manCover: "",
        womanCover: "",
        manName: "",
        womanName: "",
        time: {
          year: 0,
          month: 0,
          day: 0,
        },
      },
    };
  },

  computed: {},

  watch: {},

  created() {
    this.getBackGroundImg();
    this.getFamily();
    this.getTimeLinePage();
  },

  mounted() {
  },

  methods: {
    getFamily() {
      this.$createHttp.getFamily().then((res) => {
        if (res.code === 200) {
          this.love = res.data;
        }
      })
    },
    getTimeLinePage() {
      this.$createHttp.getTimeLinePage(this.pagination).then((res) => {
        if (res.code === 200) {
          res.data.records.forEach((c) => {
            c.content = c.content.replace(
              /\n{2,}/g,
              '<div style="height: 12px"></div>'
            );
            c.content = c.content.replace(/\n/g, "<br/>");
            c.content = this.$common.faceReg(c.content);
            c.content = this.$common.pictureReg(c.content);
          });
          this.timeLineList = this.timeLineList.concat(res.data.records);
          this.pagination.total = res.data.total;
        }
      }).catch((error) => {
        this.$message({
          message: error,
          type: "error",
        });
      });
    },
    launch() {
      if (this.pagination.total !== this.timeLineList.length) {
        this.pagination.current = this.pagination.current + 1;
        this.getTimeLinePage();
      } else {
        this.$message({
          message: "~~到底啦~~",
          type: "warning",
        });
      }
    },
  },
};
</script>

<style scoped>
.love-container {
  background-image: linear-gradient(
    to right,
    rgba(37, 82, 110, 0.1) 1px,
    var(--background) 1px
  ),
  linear-gradient(
    to bottom,
    rgba(37, 82, 110, 0.1) 1px,
    var(--background) 1px
  );
  background-size: 3rem 3rem;
}

.bg-wrap {
  height: 55vh;
  position: relative;
  overflow: hidden;
}

.love-image::before {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  background-color: var(--miniMask);
}

.love-wrap {
  width: 90%;
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.1);
  max-width: 950px;
  border-radius: 3em;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 50px 70px 30px 70px;
}

.love-avatar {
  border: rgba(255, 255, 255, 0.2) 4px solid;
  width: 180px;
  height: 180px;
}

.love-title {
  margin-top: 15px;
  text-align: center;
  font-size: 25px;
  font-weight: 700;
  color: var(--white);
}

.love-img {
  animation: imgScale 2s linear infinite;
  width: 120px;
  height: 120px;
}

#bannerWave1 {
  height: 84px;
  background: var(--bannerWave1);
  position: absolute;
  width: 200%;
  bottom: 0;
  z-index: 10;
  animation: gradientBG 120s linear infinite;
}

#bannerWave2 {
  height: 100px;
  background: var(--bannerWave2);
  position: absolute;
  width: 400%;
  bottom: 0;
  z-index: 5;
  animation: gradientBG 120s linear infinite;
}

.love-content {
  max-width: 1200px;
  overflow: hidden;
  margin: 20px auto 0;
  user-select: none;
}

.love-time-title1 {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: 0.2rem;
  line-height: 4rem;
  text-align: center;
  background-image: linear-gradient(
    270deg,
    #ff4500,
    #ffa500,
    #ffd700,
    #90ee90,
    #00ffff,
    #1e90ff,
    #9370db,
    #ff69b4,
    #ff4500
  );
  -webkit-background-clip: text;
  animation: jianBian 60s linear infinite;
  width: 3000px;
  color: rgba(0, 0, 0, 0);
}

.love-time-title2 {
  text-align: center;
  font-size: 1.5rem;
  line-height: 4rem;
  font-weight: 600;
  letter-spacing: 2px;
}

.love-time1 {
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
}

.love-time1-item {
  font-size: 4rem;
  font-weight: 700;
}

.card-content:hover,
.family-button:hover,
.family-wrap:hover {
  transform: translateY(-6px);
}

.family-button {
  position: relative;
  overflow: hidden;
  height: 150px;
  color: var(--white);
  margin: 50px auto 15px;
  border-radius: 20px;
  max-width: 350px;
  cursor: pointer;
  transition: all 0.3s;
  background: var(--love) center center / cover no-repeat;
  user-select: none;
}

.family-button::before {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  background-color: var(--miniMask);
}

.family-button-title {
  position: absolute;
  line-height: 150px;
  margin-left: 20px;
  font-size: 25px;
  font-weight: 700;
  color: var(--white);
}

.family-button-car {
  position: absolute;
  margin-left: 220px;
  margin-top: 55px;
  animation: passing 4s linear infinite;
}

.user-content > div {
  height: 65px;
  display: flex;
  align-items: center;
}

.user-content >>> .el-input__inner {
  border: none;
  height: 40px;
  width: 250px;
  background: var(--whiteMask);
}

.user-content >>> .el-textarea__inner {
  border: none;
  width: 250px;
  background: var(--whiteMask);
}

.user-content >>> .el-input__count {
  background: var(--transparent);
  user-select: none;
}

@media screen and (max-width: 1200px) {
  .user-content > div {
    display: unset;
    align-items: unset;
  }
}

@media screen and (max-width: 800px) {
  .love-wrap {
    border-radius: 1.5em;
    padding: 40px 30px 10px 30px;
  }

  .love-avatar {
    width: 120px;
    height: 120px;
  }

  .love-img {
    width: 100px;
    height: 100px;
  }

  .love-time1 {
    font-size: 1.4rem;
  }

  .love-time1-item {
    font-size: 3rem;
  }
}

@media screen and (max-width: 600px) {
  .love-wrap {
    padding: 30px 20px 10px 20px;
  }

  .love-avatar {
    width: 100px;
    height: 100px;
  }

  .love-img {
    width: 80px;
    height: 80px;
  }

  .love-time1 {
    font-size: 1rem;
  }

  .love-time1-item {
    font-size: 1.8rem;
  }

  .love-time-title2 {
    font-size: 1.2rem;
  }

  .user-content >>> .el-textarea__inner {
    width: 100%;
  }

  .user-content >>> .el-input__inner {
    width: 190px;
  }

  .card-container .tree-hole-container {
    padding: 0;
  }
}

@media screen and (max-width: 1150px) {

  .family-button {
    max-width: 780px;
  }
}
</style>
